/**
 *
 * @author 
 *
 */
class Page7 extends egret.Sprite {
    private _main: Main;
    public constructor(main: Main) {
        super();
        this._main = main;

        
        return;
        //this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.thisClick, this);
        
    }
    private touchMove(e: egret.TouchEvent): void {
        this.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.thisClickMove,this);
    }
    private version = 1;
    private mClickNum: number = 0;
    private mSkin: Boolean;
    private m_move_y = 0;
    private mChangeing: boolean;

    private thisClickMove(e: egret.TouchEvent): void {
        if(this.mChangeing) return;
        if(this.m_move_y == 0)
            this.m_move_y = e.stageY;
        else
            if(this.m_move_y < e.stageY)
            {
                this.mChangeing = true;
                egret.setTimeout(clean, this, 500);
                this._main.toPage6(this, false);
            }
            else
                this.m_move_y = 0;
                
        function clean(): void
        {
            this.mChangeing = false;
        }
    }
    
    private thisClick(e: egret.TouchEvent): void
    {
        this.mClickNum++;
        if(this.mClickNum == 1)
        {
            this.mSkin = true;
            return;
        }
    }

    public start(): void {
        egret.setTimeout(this.touchMove,this,this.mSkin ? 0 : 500);
        
        var layer:egret.Sprite = new egret.Sprite;
        this.addChild(layer);
        
        var bg: eui.Image = new eui.Image;
        bg.source = "1_1_png";
        layer.addChild(bg);
        
        if(this.version == 0) {
            var bg1: eui.Image = new eui.Image;
            bg1.source = "n_7_2_png";
            bg1.x = 100;

            layer.addChild(bg1);
        }
        
        if(this.version == 1) {
            var bg1: eui.Image = new eui.Image;
            bg1.source = "n_7_22_png";
            bg1.x = 100;

            layer.addChild(bg1);
        }
        
        var bg2: eui.Image = new eui.Image;
        bg2.source = "n_arrows_png";
        bg2.x = 300;
        bg2.y = 960;
        this.addChild(bg2);
        
        this.page7();
        this.page5();
    }
    
    public page5(): void {
        var bg: eui.Image = new eui.Image;
        bg.source = "n_7_3_png";
        bg.y = 420;
        bg.alpha = 0;
        this.addChild(bg);

        egret.Tween.get(bg).wait(500).to({
            x: 180,alpha:1,ease: egret.Ease.bounceInOut
        }, this.mSkin ? 0 :300)
    }
    
    
    public page7(): void {
        var bg1: eui.Image = new eui.Image;
        bg1.source = "7_7_png";
        bg1.x = 187;
        bg1.y = 575;
        this.addChild(bg1);

        bg1.addEventListener(egret.TouchEvent.TOUCH_TAP, this.thisClick1, this)
        
        var bg2: eui.Image = new eui.Image;
        bg2.source = "7_8_png";
        bg2.x = 187;
        bg2.y = 657;
        this.addChild(bg2);
        bg2.addEventListener(egret.TouchEvent.TOUCH_TAP, this.thisClick2, this)
            
        var bg3: eui.Image = new eui.Image;
        bg3.source = "7_9_png";
        bg3.x = 187;
        bg3.y = 740;
        this.addChild(bg3);
        bg3.addEventListener(egret.TouchEvent.TOUCH_TAP, this.thisClick3, this)
        
        if(this.version == 0) {
            var bg3: eui.Image = new eui.Image;
            bg3.source = "7_10_png";
            bg3.x = 290;
            bg3.y = 849;
            this.addChild(bg3);

            bg3.addEventListener(egret.TouchEvent.TOUCH_TAP,this.thisClick4,this)
        }
        this.mClickNum = 1;
    }
    
    private thisClick1(e:egret.TouchEvent):void
    {
        window.open("http://a.app.qq.com/o/simple.jsp?pkgname=com.hkfdt.cn.forex"); 
    }
    
    private thisClick2(e: egret.TouchEvent): void
    {
        window.open("http://a.app.qq.com/o/simple.jsp?pkgname=com.hkfdt.cn.futures"); 
    }
    
    private thisClick3(e: egret.TouchEvent): void
    {
        window.open("http://a.app.qq.com/o/simple.jsp?pkgname=com.hkfdt.cn.stock"); 
    }
    
    private thisClick4(e: egret.TouchEvent): void
    {
        this._main.toPage8();
    }
    
}
